/**
 * Copyright (C)  2011  chen wei hua.
 * Permission is granted to copy, distribute and/or modify this document
 * under the terms of the GNU Free Documentation License, Version 2.0
 * or any later version published by the Free Software Foundation;
 * with no Invariant Sections, no Front-Cover Texts, and no Back-Cover Texts.
 * A copy of the license is included in the section entitled "GNU Free Documentation License".
 */
package com.javaeye.delivery.dto;

import java.util.Date;

import com.javaeye.common.dto.DTO;
import com.javaeye.common.util.DateUtils;

public class Reason implements DTO {
	
	/**
	 * 
	 */
	private static final long serialVersionUID = 6869557529767563580L;
	
	public static final int LATER_HOUR = 16;
	
	public static final int REASON_CATEGORY_BUSINESS = 1;
	
	public static final int REASON_CATEGORY_PLAN = 2;
	
	public static final int REASON_CATEGORY_MADE = 3;
	
	public static final int REASON_CATEGORY_STORE = 4;
	
	public static final int REASON_CATEGORY_CHECK = 5;

	private int id;
	
	private Date createDate;
	
	private String orderId;
	
	private int category;
	
	private String description;
	
	public Reason() {
		this(0, "", "");
	}
	
	public Reason(int category) {
		this(category, "", "");
	}
	
	public Reason(int category, String orderId) {
		this(category, orderId, "");
	}
	
	public Reason(int category, String orderId, String description) {
		this.createDate = DateUtils.now();
		this.orderId = orderId;
		this.category = category;
		this.description = description;
	}

	public int getId() {
		return id;
	}

	public void setId(int id) {
		this.id = id;
	}

	public Date getCreateDate() {
		return createDate;
	}

	public void setCreateDate(Date createDate) {
		this.createDate = createDate;
	}

	public String getOrderId() {
		return orderId;
	}

	public void setOrderId(String orderId) {
		this.orderId = orderId;
	}

	public int getCategory() {
		return category;
	}

	public void setCategory(int category) {
		this.category = category;
	}

	public String getDescription() {
		return description;
	}

	public void setDescription(String description) {
		this.description = description;
	}

	public String getCategoryString() {
		return getCategoryString(category);
	}
	
	public static String getCategoryString(int category) {
		switch (category) {
		case REASON_CATEGORY_BUSINESS:
			return "业务";
		case REASON_CATEGORY_PLAN:
			return "计划";
		case REASON_CATEGORY_MADE:
			return "制造";
		case REASON_CATEGORY_STORE:
			return "仓库";
		case REASON_CATEGORY_CHECK:
			return "检验";
		default :
			return "";
		}
	}
}
